package com.qingyouchuxing.mall.biz.convert;

import com.qingyouchuxing.mall.biz.domain.bo.MallGoodsSpuBO;
import com.qingyouchuxing.mall.biz.domain.entity.MallGoodsSpu;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface MallGoodsSpuConvert {
    MallGoodsSpuConvert INSTANCES = Mappers.getMapper(MallGoodsSpuConvert.class);


    @Mapping(target = "updateTime", ignore = true)
    @Mapping(target = "updateBy", ignore = true)
    @Mapping(target = "searchValue", ignore = true)
    @Mapping(target = "params", ignore = true)
    @Mapping(target = "id", source = "spuId")
    @Mapping(target = "fkTenantId", ignore = true)
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "createBy", ignore = true)
    MallGoodsSpu boToEntity(MallGoodsSpuBO bo);

    List<MallGoodsSpu> boToEntity(List<MallGoodsSpuBO> bo);


    @Mapping(target = "spuId", source = "id")
    @Mapping(target = "skuList", ignore = true)
    MallGoodsSpuBO entityToBO(MallGoodsSpu entity);
}
